<include file="public@header"/>
<style>
    .userlist {
        position: absolute;
        background: #fff;
        width: 200px;
        height: 400px;
        overflow-y: auto;
        border: 1px solid #eee;
        z-index: 99;
        display: none;
    }

    .userlist ul {
        padding: 0;
    }

    .userlist ul li {
        padding-left: 10px;
        list-style: none;
    }

    .userlist ul li:hover {
        background: #eee;
    }
</style>
</head>
<body>

<!--新闻编辑页面-->

<div class="layui-fluid">

    <form method="post" class="layui-form js-ajax-form" style="margin-top: 20px;" action="{:url('news/editPost')}">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-tab layui-tab-brief">
                    <ul class="layui-tab-title">
                        <li><a href="{:url('news/index')}">列表</a></li>
                        <li class="layui-this"><a href="{:url('news/edit')}">编辑</a></li>
                    </ul>

                </div>


                <div class="layui-form-item">
                    <label for="input-name" class="layui-form-label"><span class="form-required">*</span>名称</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input" id="input-name" name="name" value="{$data.name}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="form-required">*</span>封面</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="thumb" id="thumb" value="{$data.thumb}">
                        <a href="javascript:uploadOneImage('图片上传','#thumb');">
                            <if condition="empty($data.thumb)">
                                <img src="__TMPL__/public/assets/images/default-thumbnail.png" id="thumb-preview"
                                     style="cursor: pointer;max-width:150px;max-height:150px;"/>
                                <else/>
                                <img src="{:cmf_get_image_preview_url($data.thumb)}" id="thumb-preview"
                                     style="cursor: pointer;max-width:150px;max-height:150px;"/>
                            </if>
                        </a>
                        <div class="layui-col-md12" style="margin-top: 10px">
                            <input type="button" class="layui-btn layui-btn-sm layui-btn-normal"
                                   onclick="$('#thumb-preview').attr('src','__TMPL__/public/assets/images/default-thumbnail.png');$('#thumb').val('');return false;"
                                   value="取消图片">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="input-name" class="layui-form-label"><span class="form-required">*</span>内容</label>
                    <div class="layui-input-block">
                        <script type="text/plain" id="content" name="content">{$data.content}</script>
                    </div>
                </div>

            <div class="layui-form-item">
                <div class="layui-input-block">

                    <input type="hidden" name="id" value="{$data.id}"/>
                    <button type="submit" class="layui-btn js-ajax-submit">保存</button>
                </div>
            </div>
        </div>
</div>
</div>
</div>


</form>
</div>


<script src="__STATIC__/js/wind.js"></script>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {
        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });
        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        editorcontent2 = new baidu.editor.ui.Editor();
        editorcontent2.render('info');
        try {
            editorcontent2.sync();
        } catch (err) {
        }



    });
</script>
</body>
</html>